
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>亚马逊-首页</title>
<link href="${pageContext.request.contextPath}/css/index.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/css/adv.css" rel="stylesheet" type="text/css" />
<script src="${pageContext.request.contextPath}/scripts/jquery-2.1.0.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/scripts/adv.js" type="text/javascript"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/scripts/function.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/scripts/index.js"></script>
</head>
<body>
	<%@ include file="index_top.jsp"%>
	<div id="middle">
		<div class="p_left">
			<!--商品分类-->
			<%@ include file="index_product_sort.jsp"%>
			<!--商品分类结束-->

			 <div class="pre_look">
				<h3>最近浏览</h3>
				<dl>
					<c:forEach items="${sessionScope.viewedProduct }" var="p" end="5">
						<dt>
							<img style="width: 54px; height: 54px;" src="${p.hp_file_name }" />
						</dt>
						<dd>
							<a href="${pageContext.request.contextPath }/PviewServlet?pId=${p.hp_id }&hpcId=${sessionScope.hpCID }&cate=${requestScope.pageModel.status}">${p.hp_name }</a>
						</dd>
					</c:forEach>
				</dl>
			</div> 
		</div>

		<div class="p_center" >
			<div id="wrapper">
				<div id="focus">
					<ul>
						<li><a href="#"><img src="images/T1.jpg" /></a></li>
						<li><a href="#"><img src="images/T2.jpg" /></a></li>
						<li><a href="#"><img src="images/T3.jpg" /></a></li>
						<li><a href="#"><img src="images/T4.jpg" /></a></li>
						<li><a href="#"><img src="images/T5.jpg" /></a></li>
					</ul>
				</div>
			</div>
			<div class="p_list">
				<div class="p_info">
					<img src="images/icon_sale.png"/>商品列表 
				</div>
			</div>

			<ul class="product2"  id="lili">
				<c:if test="${requestScope.pageModel.pageCount==0}">
					<img src="images/dog.png" style="width:523px;height:410px;"/>
				</c:if>
			 	<c:set value="${requestScope.pageModel.recordList}" var="products"></c:set>
				<c:forEach items="${products}" var="p">
					<li>
						<dl>
							<dt>
								<a href="${pageContext.request.contextPath }/PviewServlet?pId=${p.hp_id}&cate=${requestScope.pageModel.status}&hpcId=${sessionScope.hpCID }" target="_self"><img
									src="${p.hp_file_name}" /></a>
							</dt>
							<dd class="title">
								<a href="${pageContext.request.contextPath }/PviewServlet?pId=${p.hp_id}&cate=${requestScope.pageModel.status}&hpcId=${sessionScope.hpCID }" target="_self">${p.hp_name}</a>
							</dd>
							<dd class="price">￥${p.hp_price}</dd>
						</dl>
					</li>
				</c:forEach>
			</ul>
			
			 <div class="pager">
				<ul>
					<ul>
					<c:if test="${requestScope.pageModel.pageCount!=0}">
					<li>
						<a href="${pageContext.request.contextPath}/ProductSortServlet?cate=${requestScope.pageModel.status}&hpcId=${sessionScope.hpCID }&pageNow=${pageModel.currentPage<2?1:pageModel.currentPage-1}" id="lastPage">上一页</a></li>
						<li>
							<c:if test="${pageModel.pageCount>=pageModel.currentPage}">
							<a href="${pageContext.request.contextPath}/ProductSortServlet?pageNow=${pageModel.currentPage }&hpcId=${sessionScope.hpCID }&cate=${requestScope.pageModel.status}" >${pageModel.currentPage }</a>
							<c:if test="${pageModel.pageCount>=pageModel.currentPage+1}">
								<a href="${pageContext.request.contextPath}/ProductSortServlet?pageNow=${pageModel.currentPage+1 }&hpcId=${sessionScope.hpCID }&cate=${requestScope.pageModel.status}" >${pageModel.currentPage+1 }</a>
									<c:if test="${pageModel.pageCount>=pageModel.currentPage+2}">
										<a href="${pageContext.request.contextPath}/ProductSortServlet?pageNow=${pageModel.currentPage+2 }&hpcId=${sessionScope.hpCID }&cate=${requestScope.pageModel.status}" >${pageModel.currentPage+2 }</a>
								<c:if test="${pageModel.pageCount!=pageModel.currentPage}">
									...
								</c:if>
									</c:if>
							</c:if>
							
							</c:if>
						</li>
							
					<%-- 	 <c:forEach var="pl" begin="1" end="${requestScope.pageModel.pageCount}" varStatus="i"> 
							<li>
							<a href="${pageContext.request.contextPath}/ProductSortServlet?pageNow=${pl }&hpcId=${sessionScope.hpCID }&cate=${requestScope.pageModel.status}" >${pl }</a>
							</li> 
						 </c:forEach>  --%>
					
						<li><a href="${pageContext.request.contextPath}/ProductSortServlet?cate=${requestScope.pageModel.status}&hpcId=${sessionScope.hpCID }&pageNow=${pageModel.currentPage>=pageModel.pageCount?pageModel.pageCount:pageModel.currentPage+1}" id="nextPage">下一页</a></li>
					</c:if>
					</ul>
				</ul>
			</div>
		</div>

		<div id="p_right">
			<%@ include file="index_news.jsp"%>
			<%@ include file="hotproduct.jsp"%>
		</div>
	</div>
	
	<div id="foot">Copyright © 2016 上海海文 All Rights Reserved.</div>
</body>
</html>

